<%@page import="model.Friend"%>
<%@page import="java.util.ArrayList"%>
<%@page import="dao.FriendData"%>
<%@page import="dao.UserData"%>
<%@page import="model.User"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Quản Lý Thông Tin Tài Khoản</title>
<link rel="icon" href="image/imageWeb/orbz-fire-icon.png">
<link rel="stylesheet" href="css/skeleton.css" />
<link rel="stylesheet" href="css/FastReg.css">
</head>

<%
	String getSesAcc = (String) session.getAttribute("email");
	String getCookAcc = null;
	Cookie[] cookiesAcc = request.getCookies();
	if (cookiesAcc != null) {
		for (int i = 0; i < cookiesAcc.length; i++) {
			if (cookiesAcc[i].getName().equals("email")) {
				getCookAcc = cookiesAcc[i].getValue();
				break;
			}
		}
	}
	if(getCookAcc==null && getSesAcc==null){
		response.sendRedirect("index.jsp");
	}
	User user = UserData.getUser(getSesAcc);
	int level = UserData.getLevel(getSesAcc,"accountManager");
	ArrayList<Friend> listF = FriendData.getListFriend(getSesAcc);
	ArrayList<String> listR = FriendData.getResques(getSesAcc);
	int sai = listR.size();
%>
<style>
#container {
	background: url("image/imageWeb/bg3.png") center top no-repeat;
	width: 100%;
	height: 1800px;
	overflow: hidden;
	margin: 0 auto;
}
</style>
<body id="body">
	<div id="container">
		<div id="lazy">
			<%@ include file="LazyRig.jsp"%>
			<%@ include file="Login1.jsp"%>
			<jsp:include page="banner.jsp"></jsp:include>
		</div>
		<div id="Layout">
			<div id="head1">
				<div class="headbutton">
					<embed id="Advertisement" width="210" height="100"
						allowscriptaccess="always" wmode="transparent" quality="high"
						name="Advertisement" style="" src="video/start1.swf"
						type="application/x-shockwave-flash">
				</div>
			</div>
			<div id="head2">
				<%@ include file="Header.jsp"%>
			</div>
			<div id="headContent"></div>
			<div id="midF">
				<embed id="Advertisement" width="500" height="274"
					allowscriptaccess="always" wmode="transparent" quality="high"
					name="Advertisement" style="" src="video/fire.swf"
					type="application/x-shockwave-flash">
			</div>
			<div id="content">
				<div id="sidebar">
					<%@ include file="nav-left.jsp"%>
				</div>
				<div id="mainColumn">
					<div id="StaticTopPanel"></div>
					<div id="StaticOuter">
						<center>
								<TABLE width="550" align=center cellpadding="3" cellspacing="2"
									border=1>
									<tr>
										<td COLSPAN=3 align=center><b>THÔNG TIN ĐĂNG TÀI
												KHOẢN</B></td>
									</TR>
									<tr>
										<td rowspan="3" align=center>
											<%
												if (user.getFile().equals("")) {
											%> <img alt="" src="image/icon_1.png"> <%
 													} else {
 										%> <img alt="" src="<%=user.getFile()%>" height="78" width="78">
											<%
												}
											%>
										</td>
										<td align=left><b>Họ Tên : </b></td>
										<td align=left><b><%=user.getName()%></b></td>
									</tr>
									<tr>
										<td align="left">Email Đăng Ký</td>
										<td align=left><%=user.getEmail()%></td>
									</tr>
									<tr>
										<td align=left>Ngày Sinh</td>
										<td align=left><%=user.getDayOfBirth()%></td>
									</tr>
									<tr>
										<td align=left><jsp:include page="search.jsp"></jsp:include>
										</td>
										<td align=left>Số Điện Thoại</td>
										<td align=left><%=user.getPhone()%></td>
									</tr>
									<tr>
										<td align=left><b><h4></h4></b></td>
										<td align=left>Giới tính</td>
										<td align=left><%=user.getSex()%></td>
										<%
											if (level == 1) {
										%>
									
									<tr>
										<td align=left><b><h4>Chào Admin</h4></b></td>
										<td align=left><a href="textEditor.jsp"><input type="submit"
												value="Đăng tin tức"> </a></td>
										<td align=left></td>
									</tr>
									<tr>
										<td align=left><b><h4></h4></b></td>
										<td align=left><a href="addItem.jsp"><input type="submit"
												value="Thêm vật phẩm"> </a></td>
										<td align=left></td>
									</tr>
									<%
										}
									%>
									<tr>
									<td align=left ><h4></h4></td>
									<td align=left><a href="updateAccount2.jsp">Chỉnh sửa thông tin</a></td>
									<td align=left></td>
									</tr>
									<tr>
									<td align=left ><h4></h4></td>
									<td align=left><a href="changePassword.jsp">Đổi Mật khẩu</a></td>
									<td align=left></td>
									</tr>
									<tr>
									<td align=left ><h4></h4></td>
									<td align=left><a href="napthe.jsp">Nạp thẻ</a></td>
									<td align=left></td>
									</tr>
									<tr>
									<td align=left ><h4>Danh sách bạn</h4></td>
									<td align=left></td>
									<td align=left></td>
									</tr>
									<hr>
									<%
										for (int i = 0; i < listF.size(); i++) {
											String emailFriend = listF.get(i).getEmailFriend();
									%>
									<tr>
										<td align=left><a
											href="FriendDetail?emailFriend=<%=emailFriend%>"><%=emailFriend%>
										</a></td>
										<td align=center></td>
										<td align=center></td>
									</tr>
									<%
										}
									%>
									<tr>
									<td align=left ><h4>Danh sách Mời Kêt bạn </h4></td>
									<td align=left></td>
									<td align=left></td>
									</tr>
									
									<%
										for (int i = 0; i < sai; i++) {
											String eFriend = listR.get(i);
									%>
									<tr>
										<td align=left><a
											href="AgreeFriend?emailFriend=<%=eFriend%>"><%=eFriend%>
										</a></td>
										<td align=center></td>
										<td align=center></td>
									</tr>
									<%
										}
									%>
								</TABLE>

						</center>

					</div>
				</div>
			</div>
			<div id="footer"></div>
		</div>
	</div>
</body>
</html>